﻿using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Onion.Core;
using Onion.Core.Domain;
using Onion.Core.Repositories;

namespace Onion.Web.Controllers
{
   [HandleError]
   public class HomeController : Controller
   {
      private readonly IReasonRepository _reasonRepository =
         IoC.Resolve<IReasonRepository>();

      public ActionResult Index()
      {
         ViewData["Title"] = "Home Page";
         ViewData["Message"] = "Welcome to ASP.NET MVC!";

         IEnumerable<Reason> reasons = _reasonRepository.GetReasons();

         ViewData["reasons"] = reasons;

         return View();
      }

      public ActionResult About()
      {
         ViewData["Title"] = "About Page";

         return View();
      }
   }
}